<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <script src="../js/jquery.min.js"></script>
</head>
<body>
    <script>
        console.log("2.21函数参数解构赋值")
        
        function add([x,y]){
            return x + y;
        }

        let resault = add([1,2]);
        console.log(resault);

        console.log("=========2.22函数参数解构赋值使用默认值===========");
        function move({x=0,y=0} = {}){
            return [x,y];
        }
        console.log(move({x:3,y:8}));//[3,8]
        console.log(move({x:3}))//[3,0]
        console.log(move({}));//[0,0]
        console.log(move());//[0,0]
    </script>
</body>
</html>